package com.fcc.wfly.utils;

import javax.servlet.http.HttpServletRequest;

public class AuthUtils {

	private static final String HEADER_AUTHORIZATION = "X-API-KEY";

	private AuthUtils() {
	}

	public static boolean auth(HttpServletRequest request) {
		String authorization = request.getHeader(HEADER_AUTHORIZATION);
		return ("true".equals(ConfigUtils.getProperty("auth.enabled")) && authorization != null && authorization.equalsIgnoreCase(ConfigUtils.getProperty("auth.key"))) || !"true".equals(ConfigUtils.getProperty("auth.enabled"));
	}

}
